﻿using Terraria;
using Terraria.DataStructures;
using WorseGame.Common.Cores.Custom.Interfaces;

namespace WorseGame.Common.Cores.CustomCatchRules.Conditions
{
    public class PoolSizeCondition(int poolTileSize, bool? lessOrEqualOrGreater) : ICatchCondition {
        private readonly int _poolTileSize = poolTileSize;
        private readonly bool? _lessOrEqualOrGreater = lessOrEqualOrGreater;

        public bool IsConditionMet(FishingAttempt attempt, Projectile bobber) {
            switch (_lessOrEqualOrGreater) {
                case false:
                    return attempt.waterTilesCount <= _poolTileSize;
                case null:
                    return attempt.waterTilesCount == _poolTileSize;
                default:
                    return attempt.waterTilesCount >= _poolTileSize;
            }
        }
    }
}